
<div class="content">
        
        <div class="header">
            
            <h1 class="page-title">权限列表</h1>
        </div>
        
                  

        <div class="container-fluid">
            <div class="row-fluid">
                    
<div class="btn-toolbar">
    <a href="javascript:;" onclick="append('新增权限','{:U(\'Admin/Auth/append\')}','800','400')"><button class="btn btn-primary"><i class="icon-plus"></i>新增权限</button></a>
    
  <div class="btn-group">
  </div>
</div>
<div class="well">
    <table class="table">
      <thead>
        <tr>
          <th style="width: 80px;">#</th>
          <th>权限名称</th>
          <th>权限模块</th>
          <th>权限控制器</th>
          <th>权限方法</th>
          <th>权限管理</th>
        </tr>
      </thead>

      <tbody>

        <volist name='list' id='vo'>
        <tr>
          <!-- <if condition='$vo.status eq 1'>
            <td><span style="background-color: green;color:white;border-radius:10px;padding-left: 10px;padding-right: 10px">已设置</span></td>
          <else/>
            <td><span style="background-color: red;color:white;border-radius:10px;padding-left: 10px;padding-right: 10px">未设置</span></td>
          </if> -->
          <td>#</td>
          <td style="text-align: left">{$vo.auth_name}</td>
            
          <td>{$vo.auth_module}</td>
          <td>{$vo.auth_controller}</td>
          <td>{$vo.auth_action}</td>

          <td>
          
              <a href="javascript:;" onclick="edit('权限修改','{:U(\'Admin/Auth/edit\',array(\'auth_id\'=>$vo[\'auth_id\']))}','{$vo.auth_id}','800','400')"><button class="btn btn-primary"><i class="icon-pencil"></i></button></a>
              
              <a href="javascript:;"  onclick="del_auth('{:U(\'Admin/Auth/del\')}','{$vo.auth_id}')" role="button" data-toggle="modal"><button class="btn btn-primary"><i class="icon-remove"></i></button></a>
          </td>
        </tr>
          <volist name="vo['child']" id='vol'>
            <tr>
                <td>#</td>
                <td style="text-align: left">&nbsp; |`{$vol.auth_name}</td>
                <td>{$vol.auth_module}</td>
                <td>{$vol.auth_controller}</td>
                <td>{$vol.auth_action}</td>
                <td>
                  <a href="javascript:;" onclick="edit('角色属性修改','{:U(\'Admin/Auth/edit\',array(\'auth_id\'=>$vol[\'auth_id\']))}','{$vol.auth_id}','800','400')"><button class="btn btn-primary"><i class="icon-pencil"></i></button></a>
              
                  <a href="javascript:;"  onclick="del_auth('{:U(\'Admin/Auth/del\')}','{$vol.auth_id}')" role="button" data-toggle="modal"><button class="btn btn-primary"><i class="icon-remove"></i></button></a>
                </td>
            
            </tr>
            <volist name="vol['child']" id='voli'>
              <tr>
                <td>#</td>
                <td style="text-align: left">&nbsp; &nbsp; |`|`{$voli.auth_name}</td>
                <td>{$voli.auth_module}</td>
                <td>{$voli.auth_controller}</td>
                <td>{$voli.auth_action}</td>
                <td>
                  <a href="javascript:;" onclick="edit('角色属性修改','{:U(\'Admin/Auth/edit\',array(\'auth_id\'=>$voli[\'auth_id\']))}','{$voli.auth_id}','800','400')"><button class="btn btn-primary"><i class="icon-pencil"></i></button></a>
              
                  <a href="javascript:;"  onclick="del_auth('{:U(\'Admin/Auth/del\')}','{$voli.auth_id}')" role="button" data-toggle="modal"><button class="btn btn-primary"><i class="icon-remove"></i></button></a>
                </td>
              </tr>
            </volist>
          </volist>
        </volist>
      
      </tbody>
    </table>
</div>
<div class="pagination">
    <ul>
        {$page}
    </ul>
</div>

<script type="text/javascript">
   function append(title,url,w,h){
      layer_show(title,url,w,h);
   }
   function edit(title,url,id,w,h){
      layer_show(title,url,w,h);
   }

   function del_auth(url,auth_id){

      layer.confirm('确定要删除吗',function(index){
        $.ajax({
          type:'POST',
          url: url ,
          dataType:'json',
          data:{auth_id : auth_id},
          success: function(data){
            // alert(data);return false;
            if(data.code==1){

              layer.msg(data.info,{icon:1,time:1000},function(){
                location.href = "{:U('showlist')}";
              });
              
            }else{
              layer.msg(data.info,{icon:2,time:1000});
              return false;
            }
            
          },
          error:function(data){
            
          }

        })
      });
   }

   //搜索
  function sch(obj){

            var search = $(obj);
            var content = search.val();
            // alert(content);return false;
            
            $.ajax({
                  type:'POST',
                  url: '' ,
                  data:{search:content},
                  dataType:'json',
                  success: function(data){
                    // for(var i = 0;i<data.length;i++){
                    //   alert(data[i].status);return false;
                    // }
                    
                    var list = '';
                    for(var i = 0;i<data.length;i++){
                      var append = "append('新增管理员','{:U('Admin/Proattr/append',array('pro_id'=>"+data[i].pro_id+"))}','800','400')";


                      var edit = "edit('产品属性修改','{:U('Admin/Proattr/edit',array('pro_id'=>"+data[i].pro_id+"))}','{$vo.pro_id}','800','400')";

                      var del = "del_attr('del?attr_id="+data[i].pro_id+"')";
                      
                      list += '<tr>';
                      if(data[i].status==1){
                        list +='<td><span style="background-color: green;color:white;border-radius:10px;padding-left: 10px;padding-right: 10px">已设置</span></td><td>';
                      }else{
                        list +='<td><span style="background-color: red;color:white;border-radius:10px;padding-left: 10px;padding-right: 10px">未设置</span></td><td>';
                      }
                      list += data[i].pro_name+'</td><td>'+data[i].catename+'</td><td>'+data[i].create_time+'</td>';
                      
                      list += '<td><a href="javascript:;" onclick="'+append+'"><button class="btn btn-primary"><i class="icon-plus"></i></button></a><a href="javascript:;" onclick="'+edit+'"><button class="btn btn-primary"><i class="icon-pencil"></i></button></a><a href="javascript:;"  onclick="'+del+'" role="button" data-toggle="modal"><button class="btn btn-primary"><i class="icon-remove"></i></button></a></td></tr>';
                    }
                    
                    
                    
                    
                    $('tbody').html(list);
                  },
                  error:function(data){
                    
                  }

            })
       }
   
   
</script>

              